<?php
 /******************************************************************************
 *   GunCMS is an avid supporter of open source software. This is the appropriate 
 *   option if you are creating an open source application with a license 
 *   compatible with the GNU GPL license v3.
 *   For details http://www.gnu.org/licenses/gpl.html
 *   DO NOT USE FOR COMMERCIAL WITHOUT PERMISSION
 *
 * GunCMS Version 1.0.3
 * Copyright(c) 2009-2010, T & L GdbR
 * info@guncms.de
 * 
 * http://www.guncms.de
 ********************************************************************************/
class FgcmsGalleryBean {
	
	public function __construct() {
	// contructor function
	}
	
	//returns page by category_id
	public static function get_photos_by_id($db,$id) {
    	$strSQL = sprintf("SELECT p.* FROM ".TBL_GALLERY_PHOTO." p ".
    			" WHERE p.gallery_id ='$id'");
    	return $db->get_results($strSQL);
    }
	
	public static function get_slide_by_id($db,$id) {
    	$strSQL = sprintf("SELECT s.* FROM ".TBL_GALLERY_SLIDE." s ".
				" LEFT JOIN ".TBL_GALLERY." g ON g.slide_id=s.slide_id ".
    			" WHERE g.gallery_id ='$id'");
    	return $db->get_row($strSQL);
    }
	
	public function get_gallery2cat_by_catid($db,$catid) {
    	$sql = sprintf("SELECT * FROM ".TBL_GALLERY2CAT." WHERE cat_id='$catid'");
    	$page = $db->get_row($sql);
    	return $page;
    }
	
}
?>
